#ifdef _WIN32
#include <windows.h>
#endif

//------------------------------------------------------------------------
csINLINE
csSafeCounter::csSafeCounter()
:m_value(0)
{

}

//------------------------------------------------------------------------
csINLINE
csSafeCounter::csSafeCounter(int value)
:m_value(value)
{

}

//------------------------------------------------------------------------
csINLINE
csSafeCounter::~csSafeCounter()
{

}

//------------------------------------------------------------------------
csINLINE s32
csSafeCounter::increment()
{
#ifdef _WIN32
	return (int)InterlockedIncrement((LONG volatile*)&m_value);		
#endif
    return 0;
}

//------------------------------------------------------------------------
csINLINE s32
csSafeCounter::decrement()
{
#ifdef _WIN32
	return (int)InterlockedDecrement((LONG volatile*)&m_value);
#endif
    return 0;
}

//------------------------------------------------------------------------
csINLINE s32
csSafeCounter::getValue() const
{
	return m_value;
}

//------------------------------------------------------------------------
csINLINE bool
operator==(const csSafeCounter& lhs, const csSafeCounter& rhs)
{
	return lhs.m_value==rhs.m_value;
}